package it.irondev.appturismo.dao;

import it.irondev.appturismo.dao.example.RestauranttypeExample;
import it.irondev.appturismo.dao.provider.RestauranttypeSqlProvider;
import it.irondev.appturismo.entity.Restauranttype;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface RestauranttypeMapper {
    @SelectProvider(type=RestauranttypeSqlProvider.class, method="countByExample")
    int countByExample(RestauranttypeExample example);

    @DeleteProvider(type=RestauranttypeSqlProvider.class, method="deleteByExample")
    int deleteByExample(RestauranttypeExample example);

    @Delete({
        "delete from RestaurantType",
        "where idRestaurantType = #{idrestauranttype,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer idrestauranttype);

    @Insert({
        "insert into RestaurantType (idRestaurantType, name, ",
        "description)",
        "values (#{idrestauranttype,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, ",
        "#{description,jdbcType=VARCHAR})"
    })
    int insert(Restauranttype record);

    @InsertProvider(type=RestauranttypeSqlProvider.class, method="insertSelective")
    int insertSelective(Restauranttype record);

    @SelectProvider(type=RestauranttypeSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="idRestaurantType", property="idrestauranttype", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="description", property="description", jdbcType=JdbcType.VARCHAR),
        @Result(column="abbreviation", property="abbreviation", jdbcType=JdbcType.VARCHAR)

    })
    List<Restauranttype> selectByExample(RestauranttypeExample example);

    @Select({
        "select",
        "idRestaurantType, name, description,abbreviation",
        "from RestaurantType",
        "where abbreviation = #{abbreviation,jdbcType=VARCHAR}"
    })
    @Results({
    	@Result(column="idRestaurantType", property="idrestauranttype", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="description", property="description", jdbcType=JdbcType.VARCHAR),
        @Result(column="abbreviation", property="abbreviation", jdbcType=JdbcType.VARCHAR)
    })
    Restauranttype selectByAbbreviation(String abbreviation);
    
    @Select({
        "select",
        "idRestaurantType, name, description, abbreviation",
        "from RestaurantType",
        "where idRestaurantType = #{idrestauranttype,jdbcType=INTEGER}"

    })
    @Results({
    	@Result(column="idRestaurantType", property="idrestauranttype", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="description", property="description", jdbcType=JdbcType.VARCHAR),
        @Result(column="abbreviation", property="abbreviation", jdbcType=JdbcType.VARCHAR)
    })
    Restauranttype selectByPrimaryKey(Integer idrestauranttype);


    @UpdateProvider(type=RestauranttypeSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") Restauranttype record, @Param("example") RestauranttypeExample example);

    @UpdateProvider(type=RestauranttypeSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") Restauranttype record, @Param("example") RestauranttypeExample example);

    @UpdateProvider(type=RestauranttypeSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(Restauranttype record);

    @Update({
        "update RestaurantType",
        "set name = #{name,jdbcType=VARCHAR},",
          "description = #{description,jdbcType=VARCHAR}",
        "where idRestaurantType = #{idrestauranttype,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Restauranttype record);
}